using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._EditingTools._Conflation
{
    /// <summary>
    /// <para>Calculate Transformation Errors</para>
    /// <para>Calculates residue errors and root mean square error (RMSE) based on the coordinates of the input links between known control points to be used for spatial data transformation.</para>
    /// <para>根据用于空间数据转换的已知控制点之间的输入链路坐标计算残差误差和均方根误差 （RMSE）。</para>
    /// </summary>    
    [DisplayName("Calculate Transformation Errors")]
    public class CalculateTransformationErrors : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public CalculateTransformationErrors()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_link_features">
        /// <para>Input Link Features</para>
        /// <para>Input link features that link known control points for spatial transformation.</para>
        /// <para>用于链接已知控制点以进行空间转换的输入链接要素。</para>
        /// </param>
        /// <param name="_out_link_table">
        /// <para>Output Link Table</para>
        /// <para><xdoc>
        ///   <para>The output table containing input links feature IDs and their residual errors. The residual errors for input links are written to the specified output table that contains the following fields:</para>
        ///   <bulletList>
        ///     <bullet_item>Orig_FID—The input link feature ID</bullet_item><para/>
        ///     <bullet_item>X_Source—The x coordinate of the source or from end location of the link</bullet_item><para/>
        ///     <bullet_item>Y_Source—The y coordinate of the source or from end location of the link</bullet_item><para/>
        ///     <bullet_item>X_Destination—The x coordinate of the destination or to end location of the link</bullet_item><para/>
        ///     <bullet_item>Y_Destination—The y coordinate of the destination or to end location of the link</bullet_item><para/>
        ///     <bullet_item>Residual_Error—The residual error of the transformed location</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含输入链接要素 ID 及其残余误差的输出表。输入链接的残差将写入包含以下字段的指定输出表：</para>
        ///   <bulletList>
        ///     <bullet_item>Orig_FID - 输入链路要素标识</bullet_item><para/>
        ///     <bullet_item>X_Source - 链路源位置或终点位置的 x 坐标</bullet_item><para/>
        ///     <bullet_item>Y_Source - 链路源位置或终点位置的 y 坐标</bullet_item><para/>
        ///     <bullet_item>X_Destination - 链路的目标位置或终点位置的 x 坐标</bullet_item><para/>
        ///     <bullet_item>Y_Destination - 链路的目标位置或终点位置的 y 坐标</bullet_item><para/>
        ///     <bullet_item>Residual_Error - 变换位置的残余误差</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        public CalculateTransformationErrors(object _in_link_features, object _out_link_table)
        {
            this._in_link_features = _in_link_features;
            this._out_link_table = _out_link_table;
        }
        public override string ToolboxName => "Editing Tools";

        public override string ToolName => "Calculate Transformation Errors";

        public override string CallName => "edit.CalculateTransformationErrors";

        public override List<string> AcceptEnvironments => ["extent", "workspace"];

        public override object[] ParameterInfo => [_in_link_features, _out_link_table, _method.GetGPValue(), _out_rmse];

        /// <summary>
        /// <para>Input Link Features</para>
        /// <para>Input link features that link known control points for spatial transformation.</para>
        /// <para>用于链接已知控制点以进行空间转换的输入链接要素。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Link Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_link_features { get; set; }


        /// <summary>
        /// <para>Output Link Table</para>
        /// <para><xdoc>
        ///   <para>The output table containing input links feature IDs and their residual errors. The residual errors for input links are written to the specified output table that contains the following fields:</para>
        ///   <bulletList>
        ///     <bullet_item>Orig_FID—The input link feature ID</bullet_item><para/>
        ///     <bullet_item>X_Source—The x coordinate of the source or from end location of the link</bullet_item><para/>
        ///     <bullet_item>Y_Source—The y coordinate of the source or from end location of the link</bullet_item><para/>
        ///     <bullet_item>X_Destination—The x coordinate of the destination or to end location of the link</bullet_item><para/>
        ///     <bullet_item>Y_Destination—The y coordinate of the destination or to end location of the link</bullet_item><para/>
        ///     <bullet_item>Residual_Error—The residual error of the transformed location</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含输入链接要素 ID 及其残余误差的输出表。输入链接的残差将写入包含以下字段的指定输出表：</para>
        ///   <bulletList>
        ///     <bullet_item>Orig_FID - 输入链路要素标识</bullet_item><para/>
        ///     <bullet_item>X_Source - 链路源位置或终点位置的 x 坐标</bullet_item><para/>
        ///     <bullet_item>Y_Source - 链路源位置或终点位置的 y 坐标</bullet_item><para/>
        ///     <bullet_item>X_Destination - 链路的目标位置或终点位置的 x 坐标</bullet_item><para/>
        ///     <bullet_item>Y_Destination - 链路的目标位置或终点位置的 y 坐标</bullet_item><para/>
        ///     <bullet_item>Residual_Error - 变换位置的残余误差</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Link Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_link_table { get; set; }


        /// <summary>
        /// <para>Method</para>
        /// <para><xdoc>
        ///   <para>Transformation method to use to convert input feature coordinates.</para>
        ///   <bulletList>
        ///     <bullet_item>Affine transformation—Affine transformation requires a minimum of three transformation links. This is the default.</bullet_item><para/>
        ///     <bullet_item>Projective transformation—Projective transformation requires a minimum of four transformation links.</bullet_item><para/>
        ///     <bullet_item>Similarity transformation—Similarity transformation requires a minimum of two transformation links.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于转换输入要素坐标的变换方法。</para>
        ///   <bulletList>
        ///     <bullet_item>仿射变换 - 仿射变换至少需要三个变换链接。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>投影变换 - 投影变换至少需要四个变换链接。</bullet_item><para/>
        ///     <bullet_item>相似性变换 - 相似性变换至少需要两个变换链接。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Method")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _method_value _method { get; set; } = _method_value._AFFINE;

        public enum _method_value
        {
            /// <summary>
            /// <para>Affine transformation</para>
            /// <para>Affine transformation—Affine transformation requires a minimum of three transformation links. This is the default.</para>
            /// <para>仿射变换 - 仿射变换至少需要三个变换链接。这是默认设置。</para>
            /// </summary>
            [Description("Affine transformation")]
            [GPEnumValue("AFFINE")]
            _AFFINE,

            /// <summary>
            /// <para>Projective transformation</para>
            /// <para>Projective transformation—Projective transformation requires a minimum of four transformation links.</para>
            /// <para>投影变换 - 投影变换至少需要四个变换链接。</para>
            /// </summary>
            [Description("Projective transformation")]
            [GPEnumValue("PROJECTIVE")]
            _PROJECTIVE,

            /// <summary>
            /// <para>Similarity transformation</para>
            /// <para>Similarity transformation—Similarity transformation requires a minimum of two transformation links.</para>
            /// <para>相似性变换 - 相似性变换至少需要两个变换链接。</para>
            /// </summary>
            [Description("Similarity transformation")]
            [GPEnumValue("SIMILARITY")]
            _SIMILARITY,

        }

        /// <summary>
        /// <para>RMSE</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("RMSE")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public double _out_rmse { get; set; }


        public CalculateTransformationErrors SetEnv(object extent = null, object workspace = null)
        {
            base.SetEnv(extent: extent, workspace: workspace);
            return this;
        }

    }

}